package com.example.springresource01;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

/**
 * @author hu wenhao
 * @version 1.0.0
 * @description
 * @date 2022/6/1 11:42
 */
@Component
public class UserService {

    @Autowired
    private ApplicationEventPublisher publisher;

    public void register(){
        System.out.println("新用户注册!!!!!!!!!");
        publisher.publishEvent(new UserRegisteredEvent(this));
    }

}
